package persistence.sqlserver;

import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
import persistence.common.ConnectionProperties;

import java.sql.*;

public class SqlServerConnection {

    public static Connection getConnection(ConnectionProperties properties){
        try {
            SQLServerDataSource ds = new SQLServerDataSource();
            ds.setUser(properties.getUsername());
            ds.setPassword(properties.getPassword());
            ds.setServerName(properties.getServer());
            ds.setPortNumber(properties.getPort());
            ds.setDatabaseName(properties.getDatabase());
            return ds.getConnection();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }





}